//
//  DoubleTableViewCell.m
//  HomeFurnishing
//
//  Created by dllo on 16/3/28.
//  Copyright © 2016年 YMing. All rights reserved.
//

#import "DoubleTableViewCell.h"

@implementation DoubleTableViewCell
-(void)dealloc
{
    [_imgView release];
    [_title release];
    [_userImgView release];
    [_btn release];
    [_detailAddress release];
    [super dealloc];
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imgView = [[UIImageView alloc] init];
        //_imgView.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:_imgView];
        [_imgView release];
        
        self.title = [[UILabel alloc] init];
        //_title.backgroundColor = [UIColor greenColor];
        _title.font = [UIFont systemFontOfSize:20];
        [self.contentView addSubview:_title];
        [_title release];
        
        self.detailAddress = [[UILabel alloc] init];
        [self.contentView addSubview:_detailAddress];
        [_detailAddress release];
        
        self.btn = [UIButton buttonWithType:(UIButtonTypeSystem)];
        [self.imgView addSubview:_btn];
        [_btn setTintColor:[UIColor purpleColor]];
        [_btn addTarget:self action:@selector(btnClick) forControlEvents:(UIControlEventTouchUpInside)];
                
        self.userImgView = [[UIImageView alloc] init];
        _userImgView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_userImgView];
        [_userImgView release];
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    _imgView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 200);
    _title.frame = CGRectMake(80, _imgView.frame.size.height, SCREEN_WIDTH-80, 40);
    _detailAddress.frame = CGRectMake(80, _title.frame.origin.y + _title.frame.size.height, SCREEN_WIDTH, 30);
    _userImgView.frame = CGRectMake(0, 200, 70, 70);
    _btn.frame = CGRectMake(320, 20, 80, 30);
}

-(void)btnClick
{
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
